package solution

func V2(l1 *ListNode, l2 *ListNode) *ListNode {
	sentinel := &ListNode{}
	l3 := sentinel

	for l1 != nil && l2 != nil {
		if l1.Val <= l2.Val {
			sentinel.Next = l1
			l1 = l1.Next
		} else {
			sentinel.Next = l2
			l2 = l2.Next
		}

		sentinel = sentinel.Next
	}

	if l1 != nil {
		sentinel.Next = l1
	}

	if l2 != nil {
		sentinel.Next = l2
	}

	return l3.Next
}
